<template>
  <div class="department">
    <PageSearch @query-click="handleQueryClick" @reset-click="handleRestClick"/>
    <PageContent ref="contentRef" @new-click="handleNewClick" @edit-click="handleEditClick"/>
    <PageModal ref="modalRef"/>
  </div>
</template>

<script setup lang="ts" name="department">
import { ref } from 'vue'
import pageSearch from './c-cpns/page-search.vue'
import PageContent from './c-cpns/page-content.vue'
import PageModal from './c-cpns/page-modal.vue'

//点击了搜索 content的操作
const contentRef = ref<InstanceType<typeof PageContent>>()
const handleQueryClick = (queryInfo: any) => {
  contentRef.value?.fetchPageListData(queryInfo)
}

//重置
const handleRestClick = () => {
  contentRef.value?.fetchPageListData()
}

//新建
const modalRef = ref<InstanceType<typeof PageModal>>()
const handleNewClick = () => {
  modalRef.value?.setModalVisible()
}

//编辑
const handleEditClick= (itemData: any) => {
  modalRef.value?.setModalVisible(false, itemData)
}
</script>

<style scoped>

</style>
